package com.example.demo.T1.V1;

public class T1Test {
    public static void main(String[] args) {
        test01();
        test02();
        test03();
        test04();
        test05();
        test06();

    }

    /**
     * 重复测试
     */
    public static void test01() {
        ProA proA = new ProA();
        proA.key1 = "A";
        proA.key2 = "B";
        proA.v1 = "1";

        ProA proA2 = new ProA();
        proA2.key1 = "A";
        proA2.key2 = "B";
        proA2.v1 = "1";


        ProB proB = new ProB();
        proB.key1 = "A";
        proB.key2 = "B";
        proB.v2 = "2";

        ProB proB2 = new ProB();
        proB2.key1 = "A";
        proB2.key2 = "B";
        proB2.v2 = "3";

        MergedAB[] mergedABS = T1.merge(new ProA[]{proA, proA2}, new ProB[]{proB, proB2});
        System.out.println("------------test01----------");
        for (MergedAB mergedAB : mergedABS) {
            System.out.println(mergedAB);

        }
    }

    /**
     * A.key1.isEmpty()  && B.key2.isEMpty()
     */
    public static void test02() {

        ProA proA2 = new ProA();
        proA2.key1 = "";
        proA2.key2 = "B";
        proA2.v1 = "1";

        ProB proB = new ProB();
        proB.key1 = "A";
        proB.key2 = "";
        proB.v2 = "1";

        ProA proA03 = new ProA();
        proA03.key1 = "";
        proA03.key2 = "";
        proA03.v1 = "1";


        ProB proB03 = new ProB();
        proB03.key1 = "";
        proB03.key2 = "";
        proB03.v2 = "1";

        MergedAB[] mergedABS = T1.merge(new ProA[]{proA2, proA03}, new ProB[]{proB, proB03});
        System.out.println("------------test02----------");
        for (MergedAB mergedAB : mergedABS) {
            System.out.println(mergedAB);

        }
    }

    /**
     * null
     */
    public static void test03() {

        ProA proA2 = new ProA();
        proA2.key1 = "";
        proA2.key2 = "A";
        proA2.v1 = "1";

        ProB proB02 = new ProB();
        proB02.key1 = "A";
        proB02.key2 = null;
        proB02.v2 = "1";


        ProA proA03 = new ProA();
        proA03.key1 = null;
        proA03.key2 = "";
        proA03.v1 = "1";

        ProB proB03 = new ProB();
        proB03.key1 = null;
        proB03.key2 = "";
        proB03.v2 = "1";

        // key1=null ,key2="null"
        ProA proA04 = new ProA();
        proA04.key1 = null;
        proA04.key2 = "";
        proA04.v1 = "4";

        ProB proB04 = new ProB();
        proB04.key1 = "null";
        proB04.key2 = "";
        proB04.v2 = "4";


        MergedAB[] mergedABS = T1.merge(new ProA[]{proA2, proA03, proA04}, new ProB[]{proB02, proB03, proB04});
        System.out.println("------------test03----------");
        for (MergedAB mergedAB : mergedABS) {
            System.out.println(mergedAB);

        }
    }

    /**
     *
     */
    public static void test04() {


        ProA proA03 = new ProA();
        proA03.key1 = "ab";
        proA03.key2 = "cd";
        proA03.v1 = "1";

        ProB proB03 = new ProB();
        proB03.key1 = "a";
        proB03.key2 = "bcd";
        proB03.v2 = "1";

        // key1=null ,key2="null"
        ProA proA04 = new ProA();
        proA04.key1 = "a";
        proA04.key2 = "bcd";
        proA04.v1 = "4";

        ProB proB04 = new ProB();
        proB04.key1 = "ab";
        proB04.key2 = "cd";
        proB04.v2 = "4";


        MergedAB[] mergedABS = T1.merge(new ProA[]{proA03, proA04}, new ProB[]{proB03, proB04});
        System.out.println("------------test04----------");
        for (MergedAB mergedAB : mergedABS) {
            System.out.println(mergedAB);

        }
    }

    /**
     * key="null" ，key=null
     */
    public static void test05() {


        ProA proA = new ProA();
        proA.key1 = null;
        proA.key2 = null;
        proA.v1 = "1";

        ProB proB = new ProB();
        proB.key1 = null;
        proB.key2 = null;
        proB.v2 = "1";

        ProA proA2 = new ProA();
        proA2.key1 = "null";
        proA2.key2 = "null";
        proA2.v1 = "1";

        ProB proB02 = new ProB();
        proB02.key1 = "null";
        proB02.key2 = "null";
        proB02.v2 = "null";

        MergedAB[] mergedABS = T1.merge(new ProA[]{proA,proA2}, new ProB[]{proB,proB02});
        System.out.println("------------test05----------");
        for (MergedAB mergedAB : mergedABS) {
            System.out.println(mergedAB);

        }
    }
    /**
     */
    public static void test06() {

        MergedAB[] mergedABS = T1.merge(null, null);
        System.out.println("------------test06----------");
        for (MergedAB mergedAB : mergedABS) {
            System.out.println(mergedAB);

        }
    }
}
